//
//  SendStatusTool.swift
//  微博项目
//
//  Created by zhang on 16/3/13.
//  Copyright © 2016年 jin. All rights reserved.
//

import UIKit

class SendStatusTool: NSObject {
    class func send(status:String,image:UIImage,success:()->(Void),failure:()->(Void))
    {
        let parameter = SendStatusParameter(status: status)
        let uploadParameter = UploadDataParameter(data: UIImagePNGRepresentation(image)!, name: "pic", fileName: "pic", mimeType: "image/jpeg")
        Http.upload("https://upload.api.weibo.com/2/statuses/upload.json", parameters: parameter.mj_keyValues(), datas: [uploadParameter], successParameter: { (task:NSURLSessionDataTask, data:AnyObject?) -> Void in
                success()
            }) { (task:NSURLSessionDataTask?, error:NSError) -> Void in
                failure()
        }
    }
}
